package com.gexin.weixin.kit;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class WeiXinUtils {

	/**
	 * 支付成功返回的信息
	 * @param return_code SUCCESS 成功 FAIL 失败
	 * @param return_msg默认传空的
	 * @return
	 */
	public static String wxPayResponse(String return_code, String return_msg) {
		return "<xml><return_code><![CDATA[" + return_code + "]]></return_code><return_msg><![CDATA[" + return_msg + "]]></return_msg></xml>";
	}

	public static String filterEmoji(String source) {
		if (source == null) {
			return source;
		}
		Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
		Matcher emojiMatcher = emoji.matcher(source);
		if (emojiMatcher.find()) {
			source = emojiMatcher.replaceAll("*");
			return source;
		}
		return source;
	}
}
